package com.netbao.pro.controller;

import com.netbao.model.PageBean;
import com.netbao.model.PageResult;
import com.netbao.model.Result;
import com.netbao.pro.model.Project;
import com.netbao.pro.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pro/project")
public class ProjectController {
    @Autowired
    private ProjectService projectService;

    @GetMapping("/list")
    public PageResult list(PageBean pageBean, String cName){
        return projectService.list(pageBean,cName);
    }

    @PostMapping("/save")
    public Result save(Project project){
        System.out.println(project);
        return projectService.save(project);
    }

    @PostMapping("/delete")
    public Result delete(Long id){
//        System.out.println(id);
        return projectService.delete(id);
    }

    @GetMapping("/getvehicle")
    public PageResult getvehicle(PageBean pageBean, Long proid, Integer eid){
        return projectService.getvehicle(pageBean,proid,eid);
    }

    @PostMapping("/binDingVeh")
    public Result binDingVeh(Long proId, String vehIds){
        return projectService.binDingVeh(proId,vehIds);
    }
}
